<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String basePath = request.getScheme() + "://" + request.getServerName()
			+ ":" + request.getServerPort() + request.getContextPath();
%>
<jsp:include page="/WEB-INF/page/auth/_header.jsp"></jsp:include>
<body>
	<jsp:include page="/WEB-INF/page/auth/header.jsp"></jsp:include>
	<div id="middle">
		<jsp:include page="/WEB-INF/page/auth/menu.jsp"></jsp:include>
		<div id="right">
		    <div id="student_zczrtb">
		        <form id="student_zczrForm" class="m10">
		           	<span>${term.termName}</span>
		            <select class="form-control1" name="grade" id="grade" onchange="getClazz('student_zczr',this.value)"></select>
		            <select class="form-control1" name="clazz" id="clazz"></select>
		            	在校状态：
		            <select class="form-control1" name="status" id="status">
		                <option value="">请选择</option>
		                <option value="1">在校</option>
		                <option value="0">已转出</option>
		            </select>
		            	学生姓名：
		            <input class="form-control1" type="text" name="studentName" id="studentName">
		            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-search'" onclick="searchForm('student_zczr')">查询</a>
		            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-clear'" onclick="resetForm('student_zczr')">重置</a><br/>
		        </form>
		    </div>
		    <table id="student_zczrdg">
		    	<thead>
					<tr>
		                <th data-options="field:'grade',title:'年级号',width:50,formatter:function(value,row,index){
		                    return row.gradeName;
		                }"></th>
		                <th data-options="field:'clazz',title:'班号',width:50"></th>
		                <th data-options="field:'studentNum',title:'学号',width:50"></th>
		                <th data-options="field:'name',title:'姓名',width:50"></th>
		                <th data-options="field:'status',title:'在校状态',width:50,sortable:true,formatter:function(value,row,index){
		                    if(value == 0) return '<span style=\'color:red;\'>已转出</span>';
		                    return '在校';
		                }"></th>
		                <th data-options="width:50,align:'center',field:'操作',formatter:function(value,row,index){
		                    if(row.status == 0) return '<button type=\'button\' class=\'btn btn-warning btn-xs\' onClick=studentZczr('+row.id+',0)>转入</button>';
                    		return '<button type=\'button\' class=\'btn btn-danger btn-xs\' onClick=studentZczr('+row.id+',1)>转出</button>';
		                }">操作</th>
					</tr>
				</thead>
			</table>
		</div>
	</div>
	<jsp:include page="/WEB-INF/page/auth/_footer.jsp"/>
	<script type="text/javascript">
		var url = basePath + "/sys/student/outinput";
		var schoolId = $("#userSchoolId").val();
		$(function(){
            initDatagrid("student_zczr",url);
            initGrade("student_zczr");
	    });
		function studentZczr(id, type) {
            $.ajax({
                url: url + "/zrzc",
                type: 'POST',
                data: {
					studentId: id,
                    status: type,
					schoolId: schoolId
                }
            }).done(function(data) {
                if(data.code == '000') {
                    $.messager.show({title:'操作提示', msg:"提交成功"});
                    reload("student_zczr");
                }
            }).fail(function() {
                $('#msg').html('error,发生错误请及时联系管理员!');
            });
        }
	</script>
</body>
</html>